/* sieve2.c -- scaled down sieve with MAXPRIME instead of 8091 */
/* Eratosthenes Sieve prime number calculation */

#define MAXITER 1
#define MAXPRIME 9

       char    flags[MAXPRIME];
       int     buf[MAXPRIME];

main ()
{
       register int i,k;
       int      prime,count,iter;

       for (iter = 1;iter<=MAXITER;iter++) {
            count = 0;
            for(i = 0; i<MAXPRIME; i++)
                flags[i] = 1;
            for(i = 0; i<MAXPRIME; i++) {
                  if(flags[i]) {
                             prime = i + i + 3;
                             k = i + prime;
                             while (k < MAXPRIME) {
                                   flags[k] = 0;
                                   k += prime;
                             }
                             buf[count] = prime;
                             count++;
                   }
            }
        }
        buf[count] = 0;	
}


